<?php

namespace App\Http\Controllers\Frontend;


use App\Logics\GoodsLogic;


class GoodsController extends BaseController
{
    // 商品
    public function initialize()
    {
        parent::initialize();
    }

    // 商品列表
    public function lists()
    {
        $options = ['is_get_cate_top' => 1, 'is_get_cate_curr' => 1, 'is_get_cate_all_parent' => 0,'is_get_cate_curr_cates' => 0,'is_get_cate_top_cates' => 1,];
        $logic   = new GoodsLogic();
        $res     = $logic->lists($options);
        if($res === false){
            return $this->error($logic->getError());
        }

        return $this->success($res);
    }

    // 获取推荐商品
    public function propose()
    {
        $options = ['is_get_cate_top' => 0, 'is_get_cate_curr' => 0, 'is_get_cate_all_parent' => 0,'is_get_cate_curr_cates' => 0,'is_get_cate_top_cates' => 0,'is_get_propose' => 1,'is_get_no_cate' => 1,'is_get_number' => 10,];
        $logic   = new GoodsLogic();
        $res     = $logic->lists($options);
        if($res === false){
            return $this->error($logic->getError());
        }

        return $this->success($res);
    }

    // 商品详情
    public function show()
    {
        $options = ['is_get_cate_top' => 1, 'is_get_cate_curr' => 1, 'is_get_cate_all_parent' => 1,'is_get_cate_curr_cates' => 0,'is_get_cate_top_cates' => 1,];
        $logic   = new GoodsLogic();
        $res     = $logic->show($options);
        if($res === false){
            return $this->error($logic->getError());
        }

        return $this->success($res);
    }

}


